import { h, render } from "vue";
import Picker from "./Picker.vue";
export default (options: { label: string; value: any }[]) => {
	return new Promise((resolve, reject) => {
		const vNode = h(Picker, {
			show: true,
			options,
			onClose: () => {
				vNode.component!.props.show = false;
				reject();
			},
			onSelect: (e) => {
				vNode.component!.props.show = false;
				resolve(e);
			},
		});
		render(vNode, document.body);
	});
};
